//
//  NearbyPicCollectionViewCell.m
//  HappyTrip
//
//  Created by GeminyXC on 15-3-26.
//  Copyright (c) 2015年 lanou3g.com 蓝鸥科技. All rights reserved.
//

#import "NearbyPicCollectionViewCell.h"
//图片第三方
#import "UIImageView+WebCache.h"

@implementation NearbyPicCollectionViewCell

- (void)dealloc
{
    [_imageView release];
    [super dealloc];
}

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self.imageView = [[UIImageView alloc] init];
        [self.contentView addSubview:_imageView];
         [_imageView release];
    }
         return self;
}

- (void)applyLayoutAttributes:(UICollectionViewLayoutAttributes *)layoutAttributes
{
    CGFloat width = layoutAttributes.bounds.size.width;
    CGFloat height = layoutAttributes.bounds.size.height;
    
    self.imageView.frame = CGRectMake(0, 0, width, height);
    
    
}

//在set方法中赋值
- (void)setNearbyPicInfo:(NearbyPicObject *)nearbyPicInfo
{
    if (_nearbyPicInfo != nearbyPicInfo) {
        [_nearbyPicInfo release];
        _nearbyPicInfo = [nearbyPicInfo retain];
    }
    
    self.imageView.image = nil;
    NSString *picStr = self.nearbyPicInfo.photo_s;
    NSURL *picUrl = [NSURL URLWithString:picStr];
    [self.imageView setImageWithURL:picUrl placeholderImage:[UIImage imageNamed:@"picLoading.png"]];//加个占位图
    
}

@end
